//
//  DetailBuyyerTableViewCell.m
//  SmartCoin
//
//  Created by apple on 2018/3/15.
//  Copyright © 2018年 Cynic. All rights reserved.
//

#import "DetailBuyyerTableViewCell.h"

@implementation DetailBuyyerTableViewCell
/**
 @property (nonatomic ,retain)UIView *header;
 @property (nonatomic ,retain)UILabel  *storelabel;
 @property (nonatomic ,retain)UILabel *namelabel;
 @property (nonatomic ,retain)UILabel *joblabel;
 */

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    UIView *bgview=  [[UIView alloc] initWithFrame:CGRectMake(12, 5, cx_wid - 24, 112)];
    bgview.layer.cornerRadius = 4;
    bgview.backgroundColor = [UIColor whiteColor];
    bgview.layer.shadowOffset = CGSizeMake(3, 3);
    bgview.layer.shadowColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.4].CGColor;
    
    _header = [[UIButton alloc] initWithFrame:CGRectMake(20, 18, 76, 76)];
    _header.backgroundColor = bggrayColor;
    _header.layer.cornerRadius = 5;
    _header.userInteractionEnabled = NO;
    _header.clipsToBounds = YES;
    [bgview addSubview:_header];
    
    _storelabel = [[UILabel alloc] initWithFrame:CGRectMake(112, 18, cx_wid - 112 - 24 - 10, 25)];
    _storelabel.numberOfLines = 10;
    _storelabel.font = [UIFont systemFontOfSize:18];
    _storelabel.textColor = [UIColor blackColor];
    [bgview addSubview:_storelabel];
    
    NSArray *logos = @[@"user",@"skill"];
    for (NSInteger index = 0; index < 2; index ++) {
        UIImageView *logo = [[UIImageView alloc] initWithFrame:CGRectMake(114, 50.5 + 25 * index, 17, 17)];
        UILabel *deslabel = [[UILabel alloc] initWithFrame:CGRectMake(138, 49 + 25 * index, 70, 20)];
        deslabel.textColor = [CXSinglerModel colorWithHex:@"4A4A4A" alpha:1];
        logo.image = [UIImage imageNamed:logos[index]];
        deslabel.font = [UIFont systemFontOfSize:14];
        if (index == 0) {
            _namelabel = deslabel;
        }
        else if (index == 1){
            _joblabel = deslabel;
        }
        [bgview addSubview:deslabel];
        [bgview addSubview:logo];
    }
    
    UIButton *enterBtn = [[UIButton alloc] initWithFrame:CGRectMake(bgview.bounds.size.width - 20 - 66, 62, 66, 32)];
    enterBtn.layer.cornerRadius = 16;
    enterBtn.layer.borderWidth = 1;
    [enterBtn addTarget:self action:@selector(entertaped:) forControlEvents:UIControlEventTouchUpInside];
    enterBtn.layer.borderColor = [CXSinglerModel colorWithHex:@"FF6A4E" alpha:1].CGColor;
    [enterBtn setTitleColor:[CXSinglerModel colorWithHex:@"FF6A4E" alpha:1] forState:UIControlStateNormal];
    [enterBtn setTitle:@"进入" forState:UIControlStateNormal];
    enterBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [bgview addSubview:enterBtn];
    
    [self.contentView addSubview:bgview];
    
    return self;
}

-(void)entertaped:(UIButton *)sender{
    _btnTaped();
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
